<?php
$this->headLink()->appendStylesheet($this->baseUrl('widget/dataTable/css/dataTables.css'));
$this->headScript()->appendFile($this->baseUrl('widget/dataTable/js/jquery.dataTables.min.js'));
$this->headScript()->appendFile($this->baseUrl('widget/dataTable/js/initDataTables.js'));

$this->placeholder("navegacion")->set($this->navegacion($this->nav));
$appConfig = Zend_Registry::get("appConfig");
$domConfig = Zend_Registry::get("domConfig");
$nombre_ies  = $this->infoIES["nombrecompleto"];

$perfil = App_Perfil::getInstance();
$perfil->cargar("ADMIN_USUARIOS_IES");
?>
<div align="center">
<div style="width: 600px">
	<table width="100%" align="center" class="iceDatTbl zebra">
    <tr>
      <th><?php echo $nombre_ies; ?></th>
    </tr>
 	<tr>
      <th>Informaci&oacute;n para la asignaci&oacute;n</th>
    </tr>
    </table>
    <?php
    if ($perfil->crear()){
	    $this->form->setAction($this->baseUrl("/usuarios/instituciones/usuariosies"));
	    echo $this->form;
	    echo $this->autoCompleteUsuario->renderElement();
    }
    echo "<br /></div>";
    ?>

<?php if(count($this->datos)>0):?>
<form action="<?=$this->baseUrl("/usuarios/instituciones/desasignarseleccion");?>" method="post">
<INPUT type="hidden" name="codinstitucion" name="codinstitucion" value="<?php echo $this->codinstitucion; ?>">
<table id="table_id" align="center" class="iceDatTbl zebra">
  <thead>
    <tr>
      <th width="10%">Usuario</th>
      <th width="46%">Nombre / correo</th>
      <th width="20%">Tipo de permiso</th>
      <th width="10%">Estado</th>
	  <th width="4%"></th>
    </tr>
  </thead>
  <tbody>
	<?php foreach ($this->datos as $value):?>
	<?php
		//$params=App_Util_SafeUrl::encriptar(array("codsesion"=>$value["codsesion"]),true);
	?>
    <tr>
      <td style="text-align:center;"><?php echo $value["nombreusuario"];?></td>
      <td><?php echo "{$value["nombres"]} {$value["apellidos"]}";?></td>
      <td style="text-align:center;"><?php echo ($value["tipousuario"]=='R')?"Crear, modificar y finalizar ":"Modicar";?></td>
      <td style="text-align:center;"><?php echo $domConfig->DOM_ESTADO->get($value["estadocna"]);?></td>
	  <td style="text-align:center;"><input type="checkbox" name="seleccionados[]" value="<?=$value["codusuario"];?>" /></td>
    </tr>
  <?php  endforeach;?>
  </tbody>
</table>
<?php
    if($perfil->eliminar()) {
?>
<div align="right"><input type="submit" value="Des-asignar usuario" class="iceCmdBtn" /></div>
<?php
    }
?>
</form>
<script type="text/javascript">
$(function() {
	var oTable = $('#table_id').dataTable({
		"bJQueryUI": true,
		"bAutoWidth": false,
		"oLanguage": { "sUrl": baseUrl + "/widget/dataTable/lang.es.txt" },
 		"sPaginationType": "full_numbers",
 		"bStateSave": true,
 		"aoColumns": [
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			{ "bSortable": false, "bSearchable": false }
 	 		 		 ]
	});
	oTable.fnSetFilteringDelay();
});
</script>
<?php else: echo $this->mensajes("No existen registros");?>
<?php endif; ?>
</div>